1 00:00:00,610 --> 00:00:05,500 Before we end this course, I want to show you a tool that you can use to boost your productivity in 2 00:00:05,500 --> 00:00:07,630 Roblox Studio substantially. 3 00:00:07,900 --> 00:00:14,440 This tool is called Chat GPT and you've probably heard about it before, but if not chat. 4 00:00:14,440 --> 00:00:19,090 GPT is an AI where you can input text and it can respond back to you like a human. 5 00:00:19,120 --> 00:00:24,970 It can write essays for you, tell jokes, explain information on a particular topic and much more. 6 00:00:25,480 --> 00:00:28,090 How can we use chat GPT for scripting? 7 00:00:28,390 --> 00:00:35,920 Well, chat GPT has the ability to write, review, improve and fix code for you, including the Lua 8 00:00:35,950 --> 00:00:37,210 use scripting language. 9 00:00:37,330 --> 00:00:41,500 This means if you ever encounter an error in your code that you do not know how to fix and could not 10 00:00:41,500 --> 00:00:47,230 find the answer for or you need help understanding a section in code or you just need to improve your 11 00:00:47,230 --> 00:00:48,190 code chat. 12 00:00:48,220 --> 00:00:50,620 GPT is a must use tool for you. 13 00:00:51,400 --> 00:00:57,550 We can go to chat dot open wacom to use this tool and you'll have to create an account to use it. 14 00:00:57,850 --> 00:01:02,410 But after you do that, you should be greeted by this screen where you can enter in a prompt. 15 00:01:02,740 --> 00:01:07,000 There is also a desktop application that you can use for this tool as well, and I'll have it attached 16 00:01:07,000 --> 00:01:07,900 to this lecture. 17 00:01:08,170 --> 00:01:14,490 So to demonstrate chat gifts, code creation abilities here, I'm going to input some text and I want 18 00:01:14,500 --> 00:01:20,410 change GPT to create a function for me in Lilliput that takes a base part and moves that base part ten 19 00:01:20,410 --> 00:01:22,420 studs forward in the direction it's facing. 20 00:01:23,020 --> 00:01:32,440 So it can ask it and say something like, Hey, chat GPT can you write me a function in lieu of you 21 00:01:32,440 --> 00:01:38,770 that takes a bass part and moves the bass parts? 22 00:01:39,160 --> 00:01:45,130 See frame ten studs forward and the direction it's facing. 23 00:01:46,110 --> 00:01:48,750 Let's see what chat GPT generates for us. 24 00:01:49,960 --> 00:01:50,080 That's 25 00:01:57,880 --> 00:01:59,140 pretty impressive, right? 26 00:01:59,440 --> 00:02:01,960 Obviously, there's a little bit of an issue here. 27 00:02:02,560 --> 00:02:07,870 I don't really know what the purpose of this section is, because this will move the sea frame and whatever 28 00:02:07,870 --> 00:02:10,720 direction the C frame of the part is looking. 29 00:02:10,900 --> 00:02:15,430 But as you can see, GPT has created some code for us that should work. 30 00:02:15,940 --> 00:02:22,120 Now, if you're confused with anything in this code, well you can ask GPT to explain it for you because 31 00:02:22,120 --> 00:02:27,430 this I can remember all the previous conversations that you've had in this particular chat. 32 00:02:27,880 --> 00:02:33,280 For example, let's say I didn't know what type annotations were, and I don't know exactly what this 33 00:02:33,280 --> 00:02:35,860 colon based part is doing here in the function. 34 00:02:36,130 --> 00:02:39,180 That means I can ask Chat GP to explain it to me. 35 00:02:39,190 --> 00:02:46,270 I can say, Hey, chat GPT what does colon base part? 36 00:02:47,120 --> 00:02:51,680 Mean in the parameter section of the move. 37 00:02:52,600 --> 00:02:55,750 Part forward function. 38 00:02:56,080 --> 00:02:57,460 Let's see what it tells us. 39 00:03:05,510 --> 00:03:07,160 And as you can see here, chat. 40 00:03:07,190 --> 00:03:12,260 GPT has fully explained to us what the purpose of those lines were in great detail. 41 00:03:12,410 --> 00:03:18,440 It's telling us that this part that is being passed to this function is expected to be of the class 42 00:03:18,440 --> 00:03:19,370 base part. 43 00:03:19,550 --> 00:03:23,870 And it is telling us it is a type hint or a type annotation. 44 00:03:23,870 --> 00:03:29,750 It's not a requirement, but it helps us to improve the readability and maintainability of our code. 45 00:03:30,110 --> 00:03:35,330 You might now start to see the absolute power of this tool can have for you as a scripter and boosting 46 00:03:35,330 --> 00:03:36,500 your productivity. 47 00:03:36,770 --> 00:03:39,880 Let's give chat GPT a little bit more of a challenge. 48 00:03:39,890 --> 00:03:45,890 Let's ask it to do something more complicated like recasts so I can say something like. 49 00:03:47,470 --> 00:03:50,170 Hey chat GPT write me. 50 00:03:51,260 --> 00:03:55,700 A function in lua you that has to parameters. 51 00:03:56,660 --> 00:03:59,480 A bass part and a number. 52 00:04:00,410 --> 00:04:02,540 Using these two parameters. 53 00:04:04,900 --> 00:04:10,480 Have the function fire array cast in the direction of where. 54 00:04:12,230 --> 00:04:19,970 The base part is facing with the length defined by the number parameter. 55 00:04:20,600 --> 00:04:26,120 If this rate cast hits a part, print the name of the part. 56 00:04:27,160 --> 00:04:29,350 Let's see if Chat can do that for us. 57 00:04:43,060 --> 00:04:43,530 All right. 58 00:04:43,540 --> 00:04:44,480 This is very nice. 59 00:04:44,500 --> 00:04:47,950 It has generated some code for us for recasting. 60 00:04:47,950 --> 00:04:52,900 And it is also told us that it's ignoring the part where we are shooting this Ray Cas from. 61 00:04:52,900 --> 00:04:58,180 But there is a little bit of an issue and it's that these functions. 62 00:04:58,880 --> 00:05:03,010 And creating a new REA data type is deprecated. 63 00:05:03,020 --> 00:05:10,290 It's better to use the workspace recast function and use the recast parameters data type instead. 64 00:05:10,310 --> 00:05:13,700 Because these are deprecated, you don't want to use them for new work. 65 00:05:13,700 --> 00:05:20,300 So let's ask GPT to fix this for us because we don't want to use deprecated features we can say. 66 00:05:21,070 --> 00:05:24,790 Thanks chat GPT but unfortunately. 67 00:05:26,190 --> 00:05:27,630 Ray dot new. 68 00:05:28,380 --> 00:05:32,850 And find part on Ray is deprecated. 69 00:05:33,960 --> 00:05:43,830 Can you use recast params and workspace recast instead? 70 00:05:43,860 --> 00:05:45,150 We'll see if it'll do that. 71 00:06:00,180 --> 00:06:05,790 Okay, so it fixed one part of the section, but I don't think chat gpt fully understood what I mean 72 00:06:05,790 --> 00:06:07,980 because we still don't want to use robot new here. 73 00:06:07,980 --> 00:06:08,780 We don't need to. 74 00:06:08,790 --> 00:06:12,000 This is deprecated and we only need to use the base part. 75 00:06:12,090 --> 00:06:16,800 So let's ask GPT one more time to get rid of this deprecated feature. 76 00:06:37,110 --> 00:06:39,520 As you can tell, this is quite incredible. 77 00:06:39,540 --> 00:06:47,010 So GPT has created us an up to date function that uses non deprecated features on array casting in the 78 00:06:47,010 --> 00:06:53,040 direction that a part is facing with a distance of 20 studs as it has given our example here. 79 00:06:53,040 --> 00:06:56,370 And it explains all the important details of this function. 80 00:06:56,730 --> 00:06:59,520 So as you can see, this is very useful. 81 00:06:59,820 --> 00:07:04,020 But not only can it generate code for you, but it can also fix errors for you. 82 00:07:04,050 --> 00:07:10,200 So I'm going to create some code with a syntax error in it real quick and let's see if GPT can fix our 83 00:07:10,200 --> 00:07:10,890 problem. 84 00:07:11,820 --> 00:07:17,970 So I've written some code that's going to obviously error and I'm going to ask GPT to help me fix this 85 00:07:17,970 --> 00:07:18,530 error. 86 00:07:18,540 --> 00:07:22,560 So I'm going to tell chat GPT hey chat GPT. 87 00:07:22,740 --> 00:07:38,730 I have an error in my code where it is telling me that dot c frame is not a valid property for this 88 00:07:38,730 --> 00:07:44,100 variable I am grabbing from the workspace. 89 00:07:44,610 --> 00:07:50,100 Can you help me out and we'll paste the code down here. 90 00:07:50,430 --> 00:07:56,760 So what my code is, is we're getting a variable called part and we're finding the first child on the 91 00:07:56,760 --> 00:08:03,180 workspace that is a model and obviously a model doesn't have a C frame property, so we can't update 92 00:08:03,180 --> 00:08:08,160 the C frame of the model and this might return nil as well because there is no guarantee that we have 93 00:08:08,160 --> 00:08:09,330 a model in the workspace. 94 00:08:09,330 --> 00:08:11,190 But that's why I've added this if statement here. 95 00:08:11,190 --> 00:08:12,650 So it shouldn't check for that. 96 00:08:12,660 --> 00:08:18,150 It should just tell us that C frame is not a valid property of a part because it's a model. 97 00:08:18,150 --> 00:08:20,910 So let's see what chat GPT tells us. 98 00:08:45,650 --> 00:08:46,270 Wow. 99 00:08:46,280 --> 00:08:47,600 Very impressive. 100 00:08:47,600 --> 00:08:53,210 And it gives us a very detailed rundown of different alternative things we can do for a model such as 101 00:08:53,210 --> 00:08:58,790 moving the position property or moving all of the parts in the model by this vector. 102 00:08:59,000 --> 00:09:04,790 It explains to us exactly why we were having this error and how we could solve this problem. 103 00:09:05,330 --> 00:09:09,170 So Chad, GPT is an extremely powerful tool for scripts. 104 00:09:09,560 --> 00:09:14,750 It should improve your productivity greatly and I'd really recommend for you to use it.